package com.guchenbo.spark.core

import org.apache.spark.{SparkConf, SparkContext}

/**
 * @author guchenbo
 * @date 2022/3/2
 */
object HelloOperator {

  def main(args: Array[String]): Unit = {
    val conf = SparkUtils.conf("operator")
    val sc = new SparkContext(conf)
    var rdd = sc.makeRDD(List("a b c d", "1 2 3 4"))
    rdd = rdd.flatMap(_.split(" "))
    rdd.collect().foreach(e => println(e.getClass, e))
    val rdd2 = rdd.map(_.split(" "))
    rdd2.collect().foreach(e => println(e.getClass, e.mkString("Array(", ", ", ")")))
  }
}
